package net.zwj.service;

import java.util.Set;

import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.DelegateTask;
import org.activiti.engine.delegate.TaskListener;
import org.springframework.stereotype.Component;

@Component
public class TestTaskListener implements TaskListener {  
  
	private static final long serialVersionUID = -3072662509788441242L;

	@Override
	public void notify(DelegateTask delegateTask) {
		System.out.println("task listener start!");
		System.out.println("task event: "+delegateTask.getEventName());
		System.out.println("task name: "+delegateTask.getName());
		DelegateExecution execution = delegateTask.getExecution();
		System.out.println("execution id: "+execution.getId());
		System.out.println("businessKey: "+execution.getProcessBusinessKey());
		Set<String> names = execution.getVariableNames();
		for(String name:names){
			System.out.println("variables "+name+"--"+execution.getVariable(name));
		}
		System.out.println("task listener end!");
		
	}  
} 
